package com.leon.alishop.model;

import java.io.Serializable;
import java.util.Date;

public class ProviderInfo implements Cloneable,Serializable{

	private static final long serialVersionUID = 1L;

	private Integer id;
	
	private String name;
	
	private String address;
	
	private Integer areaId;
	
	private String contactName;

	private String phone;
	
	private String mobile;
	
	private String qq;
	
	private String wangwang;
	
	private String taobaoHomeUrl;
	
	private Integer status;
	
	private Integer storeType;
	
	private Integer validGoodsCount;
	
	private String offsale;
	
	private Date createDate;
	
	private Date modifyDate;

	public ProviderInfo() {
		super();
	}

	public ProviderInfo(Integer id, String name, String address,
			Integer areaId, String contactName, String phone, String mobile,
			String qq, String wangwang, String taobaoHomeUrl, Integer status,Integer storeType,Integer validGoodsCount,String offsale,
			Date createDate, Date modifyDate) {
		super();
		this.id = id;
		this.name = name;
		this.address = address;
		this.areaId = areaId;
		this.contactName = contactName;
		this.phone = phone;
		this.mobile = mobile;
		this.qq = qq;
		this.wangwang = wangwang;
		this.taobaoHomeUrl = taobaoHomeUrl;
		this.status = status;
		this.createDate = createDate;
		this.validGoodsCount = validGoodsCount;
		this.offsale = offsale;
		this.storeType = storeType;
		this.modifyDate = modifyDate;
	}

	public String getOffsale() {
		return offsale;
	}

	public void setOffsale(String offsale) {
		this.offsale = offsale;
	}

	public Integer getValidGoodsCount() {
		return validGoodsCount;
	}

	public void setValidGoodsCount(Integer validGoodsCount) {
		this.validGoodsCount = validGoodsCount;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getStoreType() {
		return storeType;
	}

	public void setStoreType(Integer storeType) {
		this.storeType = storeType;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Integer getAreaId() {
		return areaId;
	}

	public void setAreaId(Integer areaId) {
		this.areaId = areaId;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getQq() {
		return qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	public String getWangwang() {
		return wangwang;
	}

	public void setWangwang(String wangwang) {
		this.wangwang = wangwang;
	}

	public String getTaobaoHomeUrl() {
		return taobaoHomeUrl;
	}

	public void setTaobaoHomeUrl(String taobaoHomeUrl) {
		this.taobaoHomeUrl = taobaoHomeUrl;
	}

	public String getContactName() {
		return contactName;
	}

	public void setContactName(String contactName) {
		this.contactName = contactName;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getModifyDate() {
		return modifyDate;
	}

	public void setModifyDate(Date modifyDate) {
		this.modifyDate = modifyDate;
	}
	
	public ProviderInfo clone(){
		try {
			return (ProviderInfo) super.clone();
		} catch (CloneNotSupportedException e) {
		}
		return this;
	}
	
	public Integer getSalePrice(Integer oriPrice){
		if(oriPrice == null || this.offsale == null)
			return oriPrice;
		String _offsale = this.offsale.trim();
		float offsaleNum = 0;
		if(_offsale.indexOf("%")<0){
			try {
				offsaleNum = Float.valueOf(_offsale);
				return oriPrice + (int)(offsaleNum*100);
			} catch (Exception e) {
			}
		}else{
			try {
				_offsale = _offsale.substring(1,_offsale.length()-1);
				offsaleNum = Float.valueOf(_offsale);
				return (int) (oriPrice * (1-(float)(offsaleNum/100)));
			} catch (Exception e) {
			}
		}
		return oriPrice;
	}
	
}
